package top.lishuoboy.javaweb.a04jquery.ajax; /**
 * @author lishuoboy
 * @date 2021-12-27 15:46
 */

import lombok.extern.slf4j.Slf4j;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet(name = "TestAjaxServlet", value = "/TestAjaxServlet")
@Slf4j
public class TestAjaxServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        log.debug("name==【{}】", request.getParameter("name"));

        PrintWriter out = response.getWriter();
        out.println("<html><body>");
        out.println("<h1>hello get</h1>");
        out.println("</body></html>");
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        log.debug("name==【{}】", request.getParameter("name"));

        PrintWriter out = response.getWriter();
        out.println("<html><body>");
        out.println("<h1>hello post</h1>");
        out.println("</body></html>");
    }
}
